package com.ruoyi.books.controller;

import com.ruoyi.books.service.IColumnService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/invoice/column")
public class ColumnController {
    @Autowired
    private IColumnService columnService;

    @GetMapping
    public AjaxResult getColumn(@RequestParam("pageName") String pageName){
        List<Map> list = columnService.getColumn(pageName, SecurityUtils.getUserId());
        return AjaxResult.success(list);
    }

    @PostMapping
    public AjaxResult uploadColumn(@RequestParam("pageName") String pageName, @RequestBody List<Map> list){
        Boolean column = columnService.uploadColumn(pageName, SecurityUtils.getUserId(), list);
        return AjaxResult.success(column);
    }
}

